package org.hard;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Calendar;
import java.util.Date;

/**
 * @author: 王林博
 * @date: 2022年08月11日 9:33
 */
@SpringBootApplication
@MapperScan(value={"org.hard.**"})
public class DemoApplication {


    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class,args);
//        int i = 3;
//        int[] ints = new int[]{3,5,7,10};
//        System.out.println(ints[3]);
//        System.out.println(DateUtil.format(getDeforeDatesByDays(30),"yyyy-MM-dd HH:mm:ss"));
//        Integer startTime = Math.toIntExact(DateUtil.beginOfDay(getDatesByDays(-4)).getTime() / 1000);
//        Integer endTime = Math.toIntExact(DateUtil.endOfDay(getDatesByDays(-2)).getTime() / 1000);
//        System.out.println(startTime);
//        System.out.println(endTime);
//
//        List<Object> strings = new ArrayList<>();
//        strings.add("1");
//        strings.add("2");
//        strings.add("3");
//        List<String> rankExpertModelRows = new ArrayList<>();
//        for (Object item : strings) {
//            rankExpertModelRows.add((String) item);
//        }
//        for (Object item : rankExpertModelRows) {
//            System.out.println(item);
//        }

    }

    public static Date getDatesByDays(int days) {
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DATE, days);
        return calendar.getTime();
    }

    public static Date getDeforeDatesByDays(int days) {
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DATE,-days);
        return calendar.getTime();
    }
}
